<template>
    <div class="container" :style="'height: '+docheight+'px'">
        <leftcont></leftcont>
        <div class="righCont">
            <topcont></topcont>
            <div class="content">
                <div class="setCont">
                    <div class="mainTop" style="margin-top:20px">
                        <div class="mainTitle">新增器材</div>
                    </div>
                    <div class="formCont">
                        <el-form ref="form" label-width="120px">
                            <el-form-item label="新密码">
                                <el-input v-model="admin_password"></el-input>
                            </el-form-item>
                            <el-form-item label="管理员密码">
                                <el-input type="password" v-model="sup_password"></el-input>
                            </el-form-item>
                            <el-form-item label="">
                                <btn value="确认修改" @click="showFn"></btn>
                            </el-form-item>
                        </el-form>
                    </div>
                </div>
            </div>
        </div>
    </div>
  </template>
  
  <script>
  import leftcont from '@/components/leftCont.vue'
  import topcont from '@/components/topCont.vue'
  import btn from '@/components/public/btn.vue'
  import defUpImg from '@/components/public/defUpImg.vue'

  import { editPassword } from '@/http/api'
    export default {
      components: {defUpImg,leftcont,topcont,btn},
      data() {
        return {
          sup_password:'',
          admin_password:'',
          showData:false,
          
        }
      },
      props: {},
      methods:{
        showFn(){
          var data = {
            sup_password:this.sup_password,
            admin_password:this.admin_password,
          }
          let loading = this.$loading({
              lock: true,
              text: 'Loading',
              spinner: 'el-icon-loading',
              background: 'rgba(255, 255, 255, 0.7)'
            });
            editPassword(data).then((res)=>{
            if(res.data.code==1){
              this.$message({
                message: '修改成功',
                type: 'success'
              });
              setTimeout(() => {
                this.$router.push({path:'/login'})
              }, 1000);
            }else{
              this.$message(res.data.msg)
            }
            loading.close()
          }).catch((err)=>{
            loading.close()
            this.$message('服务器请求超时')
          });
        },
      },
      mounted(){
      },
      created() {
      },
    }
  </script>
  
  <style scoped lang="less">
  .container{
    width: 100%;
    display: flex;
    overflow: hidden;
    .righCont{
      display: flex;
      flex-direction: column;
      flex: 1;
      margin-left: 15px;
      height: 100%;
      width: 10px;
      background-color: #F4F8FF;
      .content{
        padding: 20px;
        box-sizing: border-box;
        width: 100%;
        flex: 1;
        overflow: auto;
        .setCont{
          width: 100%;
          padding: 20px;
          box-sizing: border-box;
          background-color: #fff;
          .mainTop{
            display: flex;
            margin-bottom: 25px;
            align-items: center;
            justify-content: space-between;
            .mainTitle{
              font-size: 14px;
              font-weight: bold;
            }
          }
          .formCont{
            width: 600px;
          }
        }
      }
    }
}
  </style>
  <style>
    .el-form-item__content{
        line-height: normal;
    }
</style>